package ejT5;

import java.util.Scanner;

public class Ej03 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		System.out.print("Introduce n1: ");
		int n1 = sc.nextInt();
		System.out.print("Introduce n2: ");
		int n2 = sc.nextInt();

		int mayor, menor;
		if (n1 > n2) {
			mayor = n1;
			menor = n2+1;
		} else {
			mayor = n2;
			menor = n1+1;
		}

		int acc = 0;
		for (int i = menor; i < mayor; i++) {
			acc += i;
		}
		System.out.println("La suma de los numeros entre " + n1 + " y " + n2 + " es " + acc);
	}

}
